package ledger

import (
	"jlpay-sdk-go/pkg/jlpay/core"
	"jlpay-sdk-go/pkg/jlpay/models/ledger"
	"jlpay-sdk-go/pkg/jlpay/services"
)

// BillService 账单服务
type BillService struct {
	*services.BaseService
}

// NewBillService 创建账单服务
func NewBillService(config *core.Config) *BillService {
	return &BillService{
		BaseService: services.NewBaseService(config),
	}
}

// ApplyBillURL 申请账单下载URL
func (s *BillService) ApplyBillURL(request *ledger.BillApplyUrlRequest) (*ledger.BillApplyUrlResponse, error) {
	response := ledger.NewBillApplyUrlResponse()
	err := s.Post(request, response, "/open/ledger/bill/apply/url")
	if err != nil {
		return nil, err
	}
	return response, nil
}
